Replication of “Explaining opposition to refugee resettlement: The role of NIMBYism and perceived threats” (Jeremy Ferwerda, D.J. Flynn, and Yusaku Horiuchi), Science Advances, 06 Sep 2017: Vol. 3, no. 9, e1700812. DOI: 10.1126/sciadv.1700812.

* Description:
One week after President Donald Trump signed a controversial executive order to reduce the influx of refugees to the United States, we conducted a survey experiment to understand American citizens’ attitudes toward refugee resettlement. Specifically, we evaluated whether citizens consider the geographic context of the resettlement program (that is, local versus national) and the degree to which they are swayed by media frames that increasingly associate refugees with terrorist threats. Our findings highlight a collective action problem: Participants are consistently less supportive of resettlement within their own communities than resettlement elsewhere in the country. This pattern holds across all measured demographic, political, and geographic subsamples within our data. Furthermore, our results demonstrate that threatening media frames significantly reduce support for both national and local resettlement. Conversely, media frames rebutting the threat posed by refugees have no significant effect. Finally, the results indicate that participants in refugee-dense counties are less responsive to threatening frames, suggesting that proximity to previously settled refugees may reduce the impact of perceived security threats.

* Files included in this package:
- ReadMe.txt (this file)
- [folder] data (contains data files necessary for replication)
- [folder] documents (contains information about county-level data merged with the survey data)
- [folder] figures (contains figures generated by step2_data_visualization.R)
- [folder] tables (contains tables generated by step3_regression_analysis.R)
- [folder] temp (contains temporary data generated by step1_data_wrangling.R)
- step1_data_wrangling.R
- step2_data_visualization.R
- step3_regression_analysis.R

* Programs: R version 3.4.4

* Additional packages required: tidyverse (1.2.1), lubridate (1.7.3), stargazer (5.2.1), cowplot (0.9.2), broom (0.4.4), ggthemes (3.4.0)

* Process of Replication:
	(1) Open ScienceAdvantages2017.Rproj (or set a working directory manually)
	(2) Run step1_data_wrangling.R
	(3) Run step2_data_visualization.R
	(4) Run step3_regression_analysis.R

* Note: After publishing this article, we noticed minor errors, which occurred when merging the survey data with other data. To correct for these errors, the following codes were added in step1_data_wrangling.R.

incorrectly_merged <- function(survey_data){
  re <- read.csv("data/refugee_population_share_state.csv")
  df <- left_join(survey_data, re, by = "region")
  re <- read.csv("data/refugee_highpopcounty.csv")
  df <- left_join(df, re, by = "zip")
  return(df)
}

correctly_merged <- function(survey_data){
  re <- read.csv("data/refugee_highpopcounty.csv") %>% 
    distinct(zip, .keep_all = TRUE)
  df <- left_join(survey_data, re, by = "zip")
  return(df)
}

df <- incorrectly_merged(df) # Code 1
# df <- correctly_merged(df) # Code 2

The last line of code above (Code 2) produces slightly different results from the original paper. To produce the exact same results from the paper, run the script without making any change (default: Code 1 uncommented out, Code 2 commented out). But to produce the results after fixing the errors, comment out Code 1, uncomment out Code2, and run the script.

* Most Recent Date of Successful Replication: April 2, 2018
